class PlaySongData {
  int id; // 歌曲id
  String name; // 歌曲名称
  String artists; // 演唱者
  String picUrl; // 歌曲图片

  PlaySongData(this.id, {this.name, this.artists, this.picUrl});

  PlaySongData.fromJson(Map<String, dynamic> json)
      : id = json['id'],
        name = json['name'],
        artists = json['artists'],
        picUrl = json['picUrl'];

  Map<String, dynamic> toJson() => {
    'id': id,
    'name': name,
    'artists': artists,
    'picUrl': picUrl,
  };

  @override
  String toString() {
    return 'Song{id: $id, name: $name, artists: $artists}';
  }

  static List<PlaySongData> fromJsonList(List json) {
    return json.map((item) => PlaySongData.fromJson(item)).toList();
  }
}
